define(function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function() {
                return {
                   
                    nodata:0,
                    loading:0,
                    list:[],
                    queryTime:'',
                    
                };
            },
            el: '#pageStmtPayResultQuery',
            created: function() {
                this.fetchData();
            },
             mounted: function() {
                if (this.mounted == 1) {
                    return;
                }
                this.mounted = 1;
                var that = this;
                 // 时间
                  app.datetimePickerWap("#time",{
                      title: '选择时间',
                      type :'date',
                      // years: [2017, 2018],
                      // monthes: ['06', '07'],
                      onChange: function (picker, values, displayValues) {
                          // console.log(picker);
                          var date = displayValues[0]+"-"+displayValues[1]+"-"+displayValues[2];
                          var time =displayValues[3]+":"+displayValues[4];
                          var queryTime = date;
                          that.queryTime =queryTime ;
                         
                      },
                      onOpen:function(picker){
                           $(".datetime-picker").on("close", function() {
                                // console.log("123");
                                that.getList();
                          });
                      }
                  });
               
               
            },


            methods: {
                fetchData: function() {
                   
                    this.getList();
                   
                },
                getList:function(){
                   var that = this;
                    app.get("/apiv2/mch_my_bank/stmtPayResultQuery",{
                      // shop_id:this.shop_id,
                      queryTime:this.queryTime,
                      status:0,
                     },function(res){
                         if(res.code!=200){
                             app.alert(res.msg);
                         }
                         that.list = res.data;
                         if (that.list.length === 0) {
                            that.nodata=1;
                         }
                    });
                },
                 
            }

        }).$mount('#app');
    };
    module.exports = controller;
});
